﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class dispear : MonoBehaviour
{
    // 最多碰撞次数
    private int num = 2;

    // 碰撞时候的事件
    private void OnCollisionEnter2D(Collision2D other) {
        if(other.transform.tag == "Player")
        {
            num--;
        }
        if(num == 0)
        {
            // 销毁物体
            Destroy(gameObject);
        }
    }
}
